package com.forum.config;

import com.forum.Interceprot.LoginInterceprot;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.Arrays;
import java.util.List;

/**
 * @ClassNameMyWebMvcConfig
 * @Author 张继成
 * @Date 2023/11/12 17:18
 */
@Configuration
public class MyWebMvcConfig implements WebMvcConfigurer {

    private static List<String> excludePathList = Arrays.asList("/login","/captcha");

    @Autowired
    public LoginInterceprot loginInterceprot;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceprot).addPathPatterns("/**").
                excludePathPatterns(excludePathList);
    }
}
